Skip to content

Check non-public API usage #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

swift-kim
Copy link
Member

@swift-kim swift-kim commented Jul 12, 2021

Check if any undocumented API is used by the engine or the embedder
binary (wearable only).

Contributes to #89.

Related to flutter-tizen/flutter-tizen#21.

The content of the check_symbols.py file pre-installed to the CI server is as follows:

#!/usr/bin/env python3
import os
import subprocess
import sys

class Symbol:
  def __init__(self, line):
    self.text = line
    self.address = line[:8].strip()
    self.type = line[9] # See `man nm` for details.
    self.name = line[11:].strip()

  def __str__(self):
    return self.text

def main():
  if len(sys.argv) < 2:
    print('Insufficient arguments.')
    exit(1)
  sopath = sys.argv[1]

  allowlist = []
  scriptdir = os.path.dirname(__file__)
  with open(f'{scriptdir}/4.0.0_native_whitelist_wearable_v12.txt', 'r') as f:
    allowlist = [line.rstrip() for line in f]
  if not allowlist:
    print('The allowlist is empty.')
    exit(1)

  if not os.path.exists(sopath):
    print(f'File not found: {sopath}')
    exit(1)

  symbols_raw = subprocess.run(
    f'nm -gDC {sopath}', shell=True, encoding='utf-8', stdout=subprocess.PIPE).stdout
  symbols = []
  for line in symbols_raw.splitlines():
    symbols.append(Symbol(line))

  exit_code = 0
  for sym in symbols:
    if sym.address:
      continue
    if sym.name in allowlist or sym.name.startswith('FlutterEngine'):
      continue
    print(f'{sym.name}[{os.path.basename(sopath)}]')
    exit_code = 1
  
  exit(exit_code)

if __name__ == '__main__':
  main()

Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
@swift-kim swift-kim mentioned this pull request Jul 12, 2021
10 tasks
@swift-kim swift-kim requested a review from a team July 12, 2021 05:55
Copy link
Member

@bwikbs bwikbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Wow It's pretty GOOD!

@WonyoungChoi
Copy link

WonyoungChoi commented Jul 13, 2021

Great! How about making a docker project for the CI environment? I think it needs to be managed like code.

@swift-kim
Copy link
Member Author

@WonyoungChoi I found it really complicated to use Docker along with Azure Pipelines when I was initially setting up the CI. I can't exactly remember why I thought in that way at the time. You may search for the "container" keyword in the YAML schema documentation.

@WonyoungChoi
Copy link

@swift-kim How about using GitHub Actions instead? It's a free for public repositories.

@swift-kim
Copy link
Member Author

@WonyoungChoi The difference between GitHub Actions and Azure Pipelines is that GitHub Actions only supports stateless build while Azure Pipelines supports both stateless and stateful (incremental, self-hosted) builds. I initially tried to use GitHub Actions for engine build but it couldn't even download a Docker image (https://github.com/flutter-tizen/tizen_tools/pull/3) because of the storage limit, and even if it could have downloaded the image, every build would have taken more than 60 minutes. So using GitHub Actions or anything similar to it was not a feasible option.

I had three options when I was choosing the CI system that supports stateful (self-hosted) build.

  • Jenkins
  • JetBrains TeamCity
  • Azure Pipelines

You probably know why I chose Azure Pipelines out of these.

@bwikbs bwikbs merged commit 10126fa into flutter-tizen:flutter-2.2.1-tizen Jul 13, 2021
swift-kim added a commit that referenced this pull request Sep 27, 2021
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim added a commit that referenced this pull request Nov 14, 2021
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim added a commit that referenced this pull request Dec 9, 2021
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim added a commit that referenced this pull request Dec 17, 2021
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim added a commit that referenced this pull request Feb 7, 2022
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim added a commit that referenced this pull request Feb 11, 2022
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim added a commit that referenced this pull request May 12, 2022
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim added a commit that referenced this pull request Aug 5, 2022
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
swift-kim pushed a commit that referenced this pull request Sep 1, 2022
swift-kim added a commit that referenced this pull request Sep 1, 2022
Check if any undocumented API is used by the engine or the embedder
binary (wearable only).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants