Updating Libgdx through gradle - libgdx

According to the Libgdx wiki, I should have a "gdxVersion = ..." line in my grade build file (I'm assuming of my core project). However, I do not. Is there some other way to update my libgdx?
build.gradle:
apply plugin: "java"
sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project {
name = appName + "-core"
}

Taken from the wiki:
Open up the build.gradle file in the root of your project, and locate the following line:
gdxVersion = "1.0.0"
That means you should not edit the build.gradle file in your core project, but in the root folder of your projects.
After that you should proceed according to your IDE as it's described in the wiki article.

Find out build.gradle in root of your project
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "XYZ"
gdxVersion = '1.8.0'
roboVMVersion = '1.12.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.7.0'
visRuntime = '0.3.1'
visUI = '1.0.0'
overlap2D = '0.1.0'
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
update your gdxVersion with newer version.

Usually updating gradle in the middle of a project or during an update messes up a lot of things. Just make sure your Libgdx version can handle newet Gradle versions. Most of the time you will receive a build error and will spend hours to fix that.
In my opinion, If you are not an expert just leave it be.

Related

Polymer init halt on "Running generator" (polymer-cli 1.8.0, Polymer 3.0)

I'm facing the an issue, the polymer init halted on
Running generator polymer-init-polymer-3-element:app...
same on win7 and MINGW64_NT-6.1, with polymer --version = 1.8.0, nodejs --version = v10.3.0
it seems an issue causing by yield prompt
here's my temporary solution - edit the source code of polymer-cli to make my choices:
find polymer-cli/lib/init/init.js
update
const generatorName = yield util_1.prompt(createSelectPrompt(env));
with your selection
createSelectPrompt(env);
const generatorName = 'polymer-init-polymer-3-element:app';
find polymer-cli/element/element.js
update
this.props = (yield this.prompt(prompts));
with
this.props = {name: 'my-element', 'description': 'MyElement Demo for Polymer 3.0'};

Can't set the port for Net.Core application in launchSettings.JSON

I've edited launchSettings.JSON file and changed the port like so.
"Gdb.Blopp": {
"commandName": "Project",
"launchBrowser": false,
"launchUrl": "http://localhost:4000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
It still starts on port 5000, though. Is that setting disregarded all toghether or am I missing something else?
The launchSettings.json supposed to be used by IDEs (i.e. Visual Studio), when you hit F5/Ctr+F5 and offers the options from the pull-down menu next to the start button.
Also you shouldn't directly edit that the launcherSettings.json file and instead use the Project Properties to change stuff.
One reason for this is that if you change it via project properties, Visual Studio will also edit the IIS Express files (located in the .vs/config/applicationhost.config folder of your solution).
If you want to change the port kestrel uses, use .UseUrls("http://0.0.0.0:4000") (get it either from appsettings.json or hosting.json) in Program.cs.
If you don't want to use hardcoded, you can also do something like this
Create a hosting.json:
{
"server": "Microsoft.AspNetCore.Server.Kestrel",
"server.urls": "http://localhost:4000"
}
Program.cs
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddJsonFile("hosting.json", optional: false)
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
You can also do that via commandline (AddCommandLine call is important here, from Microsoft.Extensions.Configuration.CommandLine" package).
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
Then run it via dotnet run server.urls=http://0.0.0.0:4000.
When you run IIS/IISExpress the kestrel port will be determined by UseIISIntegration().
Since .NET Core 2.0 you don't have to maintain hosting.json or modify app startup anymore. There is built-in support for setting app port, explained here: https://stackoverflow.com/a/49000939/606007

Teamcity running gulp and passing in arguments

I have setup and configured by gulp process locally and now I am trying to get it working with Teamcity.
I have already installed node, and the gulp plug in.
One of the gulp packages I am using is gulp-bump so that I can use the %build-number% variable and use it to set the version of my package.json file. I am using yargs so that I can read arguments from the command line
This is the gulp task that I am using
gulp.task('setVersion', function () {
var msg = 'Setting version';
var version = args.version;
var options = {};
if (version) {
options.version = version;
msg += ' to ' + version;
}
log(msg);
return gulp
.src(config.packages)
.pipe($.print())
.pipe(version ? $.bump(options) : $.util.noop())
.pipe(gulp.dest(config.dest.root));
});
To get this to work, from the command line i call
gulp build --version=2.3.4
build is the gulp task that I want to run, and --version is the value i want to read from the command line.
The task setVersion is a dependency of the build task.
There are other gulp tasks that use the package.json file to be included at the op of all .css and js files that are outputted but these are called as part of the build task using the package 'run-sequence'
When I run this from the command line, everything works as expected.
Within my teamcity build I have two steps defined.
Step 1 is Node.js NPM runner, which i can see is correctly pulling down all the relevant packages .
Step 2 is using the Gulp runner.
Within this task, I have set the gulp task as "build", and the additional command line parameters as --version=%build.number%
But it does not appear that the version number is being set correctly as even though in the build log it is saying
"Setting version to 2.3.4"
It is not setting the version correctly as when I review the css and js files after the build, they are not using the correct version.
However I know that teamcity is using %build.number% correctly as the next task is to produce a nuget file using NuGet Pack, and the version is set to %build.number%, and the file name of the nuget file produced does correctly include the version number.
I just cannot get the version within package.json set correctly as part of the build process.
What else can I do to correctly pass in the build number and to correctly set the version of package.json
Update
After the comments received, I have discovered that the error was with the way in which I was reading package.json
My gulpfile.js had the following:
var pkg = require('./package.json');
var banner = ['/**',
' * <%= pkg.name %>',
' * #version v<%= pkg.version %>',
' */',
''].join('\n');
I was using package gulp-header to then insert the banner at the top of the page.
$.header(banner, { pkg: pkg })
Looking at the answer to this question : Javascript: get package.json data in gulpfile.js
it was mentioned that when you use require to load package.json the file is cached, and if any process modifies the package.json file, gulp will not update the version that it has already cached.
So I modified the routine to read the package.json file on demand:
var fs = require('fs');
function getPackageJson() {
return JSON.parse(fs.readFileSync('./package.json'));
}
So in my processes that where appending the header, I changed to call getPackageJson. Now when i run the process in teamcity, it is correctly setting the correct version
e.g.
var pkg = getPackageJson();
return gulp
.src(config.src.sass)
.pipe($.sass())
.pipe($.header(banner, { pkg: pkg }))
just check if below works
update package.json
gulp.task('bump-version', function () {
return gulp.src(['./bower.json', './package.json'])
.pipe(plugins.if(!bumpOpt.type, plugins.prompt.prompt(bumpPrompt, function(res){ bumpOpt.type = res.bump; })))
.pipe(plugins.bump(bumpOpt).on('error', plugins.util.log))
.pipe(gulp.dest('./'));
});
and then read the version using
function getPackageJsonVersion () {
//We parse the json file instead of using require because require caches multiple calls so the version number won't be updated
return JSON.parse(fs.readFileSync('./package.json', 'utf8')).version;
};
and use this function like
gulp.task('create-new-tag', function (cb) {
var version = getPackageJsonVersion();
plugins.git.tag(version, 'Created Tag for version: ' + version, function (error) {
if (error) { return cb(error); }
plugins.git.push('origin', 'master', {args: '--tags'}, cb);
});
});

Set tags on BoxFile using Box Android SDK v2

I want to set tags on a file I am uploading using the Box Android Library v2. As far as I can tell you can only getTags from a file but there is no API method to set tags on upload or later. The only implementation of setTag that I found is in BoxItemRequestObject but this interface does not apply to BoxFile or BoxFileUploadRequest.
Below is what I would expect to be able to do, call setTag on the requestObject but there is no such api method available.
File file = new File(filePath);
BoxFileUploadRequestObject requestObject = BoxFileUploadRequestObject.uploadFileRequestObject(folderId.getFolderId(), file.getName(), file);
requestObject.setTag(myTag);
BoxFile boxFile = client.getFilesManager().uploadFile(requestObject);
I found the answer on their github repo.
BoxFileRequestObject requestObject = BoxFileRequestObject.getRequestObject();
requestObject.put(BoxFile.FIELD_TAGS, new String[] { "first tag", "second tag"});
boxClient.getFilesManager().updateFileInfo(fileId, requestObject);

how to create project for wp8/winrt

in create_project.py
# Create cross-platform cocos2d-x project
# define global variables
PLATFORMS = {
"cpp" : ["ios", "android", "win32", "mac", "linux"],
}
I can not find out the parameter to create the cocos2dx project for wp8/winrt.
Your comment welcome
My create_project.py file looks exactly like this: http://www.cocos2d-x.org/attachments/2790/create_project.py (I use version 2.2.1). If you specify cpp in the parameters, it creates wind32 and winrt in platforms_list:
if ("cpp" == context["language"]):
context["src_project_name"] = "HelloCpp"
context["src_package_name"] = "org.cocos2dx.hellocpp"
context["src_project_path"] = os.getcwd() + "/../../template/multi-platform-cpp"
platforms_list = ["ios",
"android",
"win32",
"winrt",
"wp8",
"mac",
"blackberry",
"linux",
"marmalade"]
Then it uses those values here:
for platform in platforms_list:
processPlatformProjects(platform)
Project template is supposed to be created in your project path.
cocos2d-x 3.0 doesnt support winrt or windows phone. You would have to use 2.2.3 for it and cpp as the language.
For winrt you would use the proj.winrt folder and proj.wp8 or proj.wp8-XAML for making games for wp8.