Closed zicklag closed 5 years ago
I had to give an absolute path in my khafile.js to include a kore project, can you confirm if the path shown in the error is omitting a folder? Because that's the case for me.
edit
By your error it looks like it's including the folder twice.
The problem is that the khafile.js
in the project folder, /home/zicklag/programs/armory/ armory_examples/multitouch/
and it generates a Kore project with a korefile.js
in the build dir /home/zicklag/programs/armory/ armory_examples/multitouch/testbuild_2
. That korefile.js tries to include the subproject in android-native-hl-build
, but it fails because it appends the build dir, testbuild_2
, to the addProject
statement when it shouldn't. I'm going to try to write a PR to fix it.
BTW @RobDangerous I actually like the idea of not having to use Android Studio to compile the project, I just need a way to build the APK after the code is compiled.
I don't know what is happening in my case though, it omits the root folder.
also I build without android studio using gradlew
in the build/android-native-build/projectname/
.\gradlew assembleDebugArm7
or
.\gradlew assembleReleaseArm7
Oh, nifty about gradlew. :+1:
About your problem, do you have some logs from a run on your side? Or maybe the korefile.js that it creates in the build folder after running Khamake?
OK, I think I've fixed it. At least the problem that I had.
let fs = require('fs');
let path = require('path');
let project = new Project('Alchemy');
project.addDefine('HXCPP_API_LEVEL=332');
project.addDefine('HXCPP_DEBUG', 'Debug');
project.targetOptions = {"html5":{},"flash":{},"android":{"screenOrientation":"portrait"},"ios":{}};
project.setDebugDir('build/android-native');
await project.addProject('build/android-native-build');
await project.addProject('E:/Programming/haxe/Kha');
if (fs.existsSync(path.join('Libraries/alchemy', 'korefile.js'))) {
await project.addProject(path.join('..', 'Libraries/alchemy'));
}
if (fs.existsSync(path.join('Libraries/powerbracelet', 'korefile.js'))) {
await project.addProject(path.join('..', 'Libraries/powerbracelet'));
}
if (fs.existsSync(path.join('Libraries/korempt', 'korefile.js'))) {
await project.addProject(path.join('..', 'Libraries/korempt'));
}
if (fs.existsSync(path.join('Libraries/modplayer', 'korefile.js'))) {
await project.addProject(path.join('..', 'Libraries/modplayer'));
}
if (fs.existsSync(path.join('E:/Software/Haxe/lib/tweenxcore', 'korefile.js'))) {
await project.addProject('E:/Software/Haxe/lib/tweenxcore');
}
if (fs.existsSync(path.join('E:/Software/Haxe/lib/tweenx', 'korefile.js'))) {
await project.addProject('E:/Software/Haxe/lib/tweenx');
}
if (fs.existsSync(path.join('E:/Software/Haxe/lib/tweenxcore', 'korefile.js'))) {
await project.addProject('E:/Software/Haxe/lib/tweenxcore');
}
if (fs.existsSync(path.join('E:/Software/Haxe/lib/hxColorToolkit', 'korefile.js'))) {
await project.addProject('E:/Software/Haxe/lib/hxColorToolkit');
}
if (fs.existsSync(path.join('E:/Software/Haxe/lib/hxsignal', 'korefile.js'))) {
await project.addProject('E:/Software/Haxe/lib/hxsignal');
}
if (fs.existsSync(path.join('E:/Software/Haxe/lib/hscript', 'korefile.js'))) {
await project.addProject('E:/Software/Haxe/lib/hscript');
}
resolve(project);
It's the korempt one, so it seems fine but the error says:
Error: ENOENT: no such file or directory, open 'E:\Programming\haxe\Libraries\korempt\korefile.js'
between haxe
and Libraries
there should the project folder
OK, I think I see what you mean. Could you show your khafile.js? I'll try to reproduce this real quick, and I'll add a fix for this to my PR if I figure it out.
var fs = require('fs');
let project = new Project('Alchemy');
//Assets
project.addAssets('Libraries/powerbracelet/Assets/**');
project.addAssets('Assets/**',{
nameBaseDir: 'Assets',
destination: '{dir}/{name}',
name: '{dir}/{name}'
});
//Sources
project.addSources('Sources');
//Shaders
project.addShaders('Libraries/alchemy/Shaders/**');
//Libraries
project.addLibrary('alchemy');
project.addLibrary('powerbracelet');
//project.addLibrary('zui');
project.addLibrary('korempt');
project.addLibrary('modplayer');
project.addLibrary('tweenxcore');
project.addLibrary('tweenx');
project.addLibrary('hxColorToolkit');
project.addLibrary('hxsignal');
// project.addLibrary('haxeui-core');
// project.addLibrary('haxeui-kha');
project.addLibrary('hscript');
project.targetOptions.android_native.screenOrientation = 'portrait';
project.windowOptions.width = 360;
project.windowOptions.height = 640;
//project.addDefine("arch_debug");
callbacks.postHaxeCompilation = addJsFiles;
resolve(project);
function addJsFiles(){
//-------------------------------------------------------------
// Include files
//-------------------------------------------------------------
var path = '';
if(platform === Platform.DebugHTML5){
path = './build/debug-html5/';
}
else if (platform === Platform.HTML5){
path = './build/html5/';
}
if(path !== '' && fs.existsSync(path) === false){
fs.mkdirSync(path);
}
if(path !== ''){
fs.createReadStream('./jsincludes/debug/index.html').pipe(fs.createWriteStream(path + 'index.html'));
fs.createReadStream('./jsincludes/chiptunejs/chiptune2.js').pipe(fs.createWriteStream(path + 'chiptune2.js'));
fs.createReadStream('./jsincludes/chiptunejs/libopenmpt.js').pipe(fs.createWriteStream(path + 'libopenmpt.js'));
fs.createReadStream('./jsincludes/chiptunejs/libopenmpt.js.mem').pipe(fs.createWriteStream(path + 'libopenmpt.js.mem'));
}
}
//-------------------------------------------------------------
// var shaderDefines = ['#define GLE_FRAGCOORD'];
// console.log(platform);
// if(platform === Platform.DebugHTML5){
// shaderDefines = ['#define GLE_FRAGCOORD'];
// }
// else{
// shaderDefines = [];
// }
// var fs = require('fs');
// fs.truncate('./Libraries/alchemy/Sources/ShaderIncludes/defines.glsl',0, function(e){});
// var file = fs.createWriteStream('./Libraries/alchemy/Sources/ShaderIncludes/defines.glsl');
// file.on('error', function(err) { console.log(err) });
// shaderDefines.forEach(function(v) { file.write(v + '\n'); });
// file.end();
//-------------------------------------------------------------
//-------------------------------------------------------------
this is the full khafile.js
You are getting the error when you run Koremake right? Are you running Koremake from inside of the build dir?
No im calling khamake from the root folder.
Oh, and does Khamake start building the project immediately when you run it?
I'm able to run Khamake in my project folder which contains the khafile.js and it will put the build files in the ./build
directory. Then I move to the build directory and I run Koremake.
# From my project dir
$ node /home/zicklag/programs/armory/armsdk/Kha/make.js
Using Kha from /home/zicklag/programs/armory/armsdk/Kha
Creating Kha project.
Exporting asset 1 of 3 (Scene.arm).
...redacted...
Compiling shader 8 of 8 (painter-video.vert.glsl).
korefile found.
Creating Linux project files.
Done.
$ cd build
$ node /home/zicklag/programs/armory/armsdk/Kha/Kore/make.js --compile
korefile found.
Creating Linux project files.
Compiling shader 1 of 10 (g1.frag).
Compiling shader 2 of 10 (g1.vert).
...redacted...
It does some parts and then it cuts off with that error.
I can build my project by giving the absolute path though. I rather not move to the build folder.
OK, then that should be fine for now.
I've recently updated Kha to the latest and noticed that there are some errors trying to do a *-hl builds in Armory ( I have tested running Khamake without using Armory to verifiy that it is not specific to Armory ).
Issue Description
When I try to run the build I get:
I noticed that it doesn't create the android studio project like it used to and it complains that a korefile is not found.
An attempt to build the generated project using koremake yelds:
There is a line in the Korefile that points to the wrong path for the subproject so I replaced that line:
and then re-ran the build:
And it successfully compiles the native binary.
Summary
So I did manage to get a binary for Android, but I don't know how to package it, and I can't just use Android Studio because it didn't generate an Android Studio project. I don't think it is a bad idea to build the project with Koremake, but I think there should be an option to generate the project files for an applicable IDE like it did before.
Anyway, I'm not sure if you were just in the middle of working something out or not, but that is my experience. I'm just going to roll back the commits ( Kode/koremake@1ce323106a8f6e9121eb47cce9093a6a226eb914 and Kode/khamake@18800f9cb66cace491a8525013af145e109b9742 ) that caused the issue so that I can get the old behaviour back for now.