Menci / arcaea-builder

Build your own Arcaea game client to play self-made or modified official charts!
2 stars 0 forks source link

Strange pre-process #1

Closed TechnoHT closed 3 years ago

TechnoHT commented 3 years ago

It seem like action.ts won't process the apktool if an empty .yaml file could not be found

yarn action unpack arcaea_3.5.3c.apk
yarn run v1.22.5
$ ts-node -r tsconfig-paths/register src/main unpack arcaea_3.5.3c.apk
info:    Project directory: /home/reifuku/arcaea-builder
Error: ENOENT: no such file or directory, open '/home/reifuku/arcaea-builder/project.yaml'
    at Object.openSync (node:fs:582:3)
    at Object.readFileSync (node:fs:450:35)
    at Object.loadConfig (/home/reifuku/arcaea-builder/src/config.ts:50:42)
    at Object.<anonymous> (/home/reifuku/arcaea-builder/src/main.ts:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Module.m._compile (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1056:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Object.require.extensions.<computed> [as .ts] (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
error Command failed with exit code 1.

I tried to load the .yaml with touch, but no luck : binary.yaml not found after I load the binary.yaml it reproduce the same step as repack.ts does : finding folders sound much more complex than exec the apktool and ignore the unpack script

Menci commented 3 years ago

You should not set env ARC_PROJECT to .. Use a absolute path instead. You can use export ARC_PROJECT=`pwd` instead.

The unpack action also doesn't take an argument. It uses the filename in project.yaml.

TechnoHT commented 3 years ago

You should not set env ARC_PROJECT to .. Use a absolute path instead. You can use export ARC_PROJECT=`pwd` instead.

The unpack action also doesn't take an argument. It uses the filename in project.yaml.

I already exported my desired path but after configuring the yaml and run it generate the following error :

error:   Action "unpack" failed with an exception: TypeError: Cannot read property 'original' of undefined
    at Object.action (/home/reifuku/arcaea-builder/src/actions/unpack.ts:16:80)
    at Object.runAction (/home/reifuku/arcaea-builder/src/action.ts:35:23)
    at Object.<anonymous> (/home/reifuku/arcaea-builder/src/main.ts:15:1)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Module.m._compile (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1056:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Object.require.extensions.<computed> [as .ts] (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
Menci commented 3 years ago

How did you write your project.yaml? It seems the project config is undefined. It's very strange.

TechnoHT commented 3 years ago

How did you write your project.yaml? It seems the project config is undefined. It's very strange.

here is it :

tools:
  apktool: apktool
  jarsigner: jarsigner

original:
  android: arcaea_3.5.3c.apk

version: "1.0.0"
androidPackage:
  versionCode: 100000
  signing:
    keystore: /reifuku.keystore
    storepass: ""
    alias: reifuku_alias

name: Arcaea
packageId: moe.my.arc

server: localhost:8080

icon:

packs:
  free:
    - pack1

the apk should be pointed as Path I guess ? since I exported to another directory instead of just pwd for convenience or there is some missing points that I forgot to include

Menci commented 3 years ago

Run ls -lah $ARC_PROJECT/* and let me check it.

TechnoHT commented 3 years ago
ls -lah $ARC_PROJECT/*
total 565M
drwxr-xr-x 2 reifuku reifuku 4.0K Jun 21 20:31 .
drwxr-xr-x 8 reifuku reifuku 4.0K Jun 21 20:31 ..
-rw-r--r-- 1 reifuku reifuku 565M Apr  1 17:23 arcaea_3.5.3c.apk
-rw-r--r-- 1 reifuku reifuku  953 Jun 21 20:20 project.yaml
-rw-r--r-- 1 reifuku reifuku 2.7K Jun 21 20:19 reifuku.keystore

could it be something related on how Yarn read the exported Path instead ?

Menci commented 3 years ago

Your arcaea_3.5.3c.apk should be in a original directory inside the project directory

Menci commented 3 years ago

But it doesn't seem to be the error caused the panic. Could you add a console.log(projectConfig); line after this line in config.ts?

TechnoHT commented 3 years ago

Your arcaea_3.5.3c.apk should be in a original directory inside the project directory

So I have to make a tree like this? 🤔 /original .apk file -- /ARC_PROJECT -- project.yaml

Menci commented 3 years ago

You can refer to the example project.

TechnoHT commented 3 years ago

But it doesn't seem to be the error caused the panic. Could you add a console.log(projectConfig); line after this line in config.ts?

it printed out my project.yaml and the following error

error:   Action "unpack" failed with an exception: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:363:5)
    at validateString (node:internal/validators:119:11)
    at Object.join (node:path:1172:7)
    at Object.action (/home/reifuku/arcaea-builder/src/actions/unpack.ts:17:37)
    at Object.runAction (/home/reifuku/arcaea-builder/src/action.ts:35:23)
    at Object.<anonymous> (/home/reifuku/arcaea-builder/src/main.ts:15:1)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Module.m._compile (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1056:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Object.require.extensions.<computed> [as .ts] (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1059:12)
TechnoHT commented 3 years ago

here is my global configuration : node --version : 16.3.0 yarn --version : v1.22.5 apktool --version 2.4.0-dirty jdk 16 headless

SUSE Linux Enterprise 15

Menci commented 3 years ago

OK I still don't know what the previous error is but it get disappeared.

The new error is that you didn't write the filename of the iOS package. Maybe you want to process the Android package only. I'll add this feature later.

TechnoHT commented 3 years ago

OK I still don't know what the previous error is but it get disappeared.

The new error is that you didn't write the filename of the iOS package. Maybe you want to process the Android package only. I'll add this feature later.

lollllllll 😂 anyway the previous error is solved by pointing the apk directly with /androidOriginalPackageDir instead of /original/androidOriginalPackageDir

Menci commented 3 years ago

I added single-target support in https://github.com/Menci/arcaea-builder/commit/6fc5bddd65ef349fb7de7c65cefa7abfd04d3a33. You can build for just Android now.

TechnoHT commented 3 years ago

I added single-target support in 6fc5bdd. You can build for just Android now.

 yarn action unpack
yarn run v1.22.5
$ ts-node -r tsconfig-paths/register src/main unpack
info:    Project directory: /home/reifuku/arcaea-builder/arcaea
{
  tools: { apktool: 'apktool', jarsigner: 'jarsigner' },
  targets: { android: 'arcaea_3.5.3c.apk' },
  version: '1.0.0',
  androidPackage: {
    versionCode: 100000,
    signing: {
      keystore: '/reifuku.keystore',
      storepass: '21102003@',
      alias: 'reifuku_alias'
    }
  },
  name: 'SidaArcaea',
  packageId: 'moe.my.arc',
  server: 'localhost:8080',
  icon: null,
  packs: { free: [ 'pack1' ] }
}
error:   Action "unpack" failed with an exception: TypeError: Cannot read property 'android' of undefined
    at Object.action (/home/reifuku/arcaea-builder/src/actions/unpack.ts:16:89)
    at Object.runAction (/home/reifuku/arcaea-builder/src/action.ts:35:23)
    at Object.<anonymous> (/home/reifuku/arcaea-builder/src/main.ts:15:1)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Module.m._compile (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1056:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Object.require.extensions.<computed> [as .ts] (/home/reifuku/arcaea-builder/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
error Command failed with exit code 1.

It seem like I can't use the old folder tree with the new yaml configuration ( renamed the original to targets ) didn't help

Menci commented 3 years ago

Did you forget to run git pull?

TechnoHT commented 3 years ago

Did you forget to run git pull?

ah fak git aborted unpack.ts cuz I changed a bit :p

TechnoHT commented 3 years ago

Seem to be fine now. Thanks :D